<?php
    session_start();
    require_once 'config.php';
    if (!isset($_SESSION['user']) && str_replace("/", "", $_SERVER['PHP_SELF'])!='login.php') {
        header('Location: login.php');
        exit;
    }elseif(isset($_SESSION['user'])){
        require_once 'classes/user.dao.php';
        require_once 'classes/group.dao.php';

        $user = unserialize($_SESSION['user']);
        $user_manager = new UserManager($conn);
        $group_manager = new GroupManager($conn);
        $group = $group_manager->getGroupById($user->getGroupId());
        $user_manager->setPermisos($group->getMask());
    }
?>